package com.lin.filegraph.utils.parser.node;

import org.eclipse.jdt.core.dom.ASTNode;

import java.util.List;

/**
 * @description:
 * @author: linhuaixu
 * @time: 2023/5/18 10:24
 */

public class JClassNode extends JTypeNode {

    public boolean isAnonymous = false;

    private String strSuperClass = null;// ��������Ƿ��Զ�����

    public JClassNode(String filePath, ASTNode astNode, String className, String modifier, String strOuterType, List<String> listStrSuperInterface, boolean isAnonymous, String strSuperClass) {
        super(filePath, astNode, className, modifier, strOuterType, listStrSuperInterface);
        this.isAnonymous = isAnonymous;
        this.strSuperClass = strSuperClass;
    }

    public String getStrSuperClass() {
        return strSuperClass;
    }

    public void setStrSuperClass(String strSuperClass) {
        this.strSuperClass = strSuperClass;
    }

    @Override
    public String toString() {
        return "[ClassNode] " + getTypeName() + "  StartLine: " + getStartLine();
    }

    @Override
    public void displayStrInheritance() {
        // TODO Auto-generated method stub
        if (getStrSuperClass() != null || !getListStrSuperInterface().isEmpty()) {
            System.out.println(this);
            if (getStrSuperClass() != null) {
                System.out.println("    StrSuperClass:" + getStrSuperClass());
            }
            if (!getListStrSuperInterface().isEmpty()) {
                System.out.println("    StrImplementedInterfaces:" + getListStrSuperInterface());
            }
        }
    }
}

